home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2001 May / may_2001.iso / intercd / root / Html / ^CutePage / data1.cab / JsBox_Template / staytime_PageletServer.JsBox.pgt < prev    next >
Encoding:
Text File  |  2000-05-12  |  1.5 KB  |  49 lines

  1. ========== Description Part Begin ==========
  2. Title = staytime
  3. ProgID = PageletServer.JsBox
  4. LastUpdateTime = 36418.655057870
  5. PreviewPath = 
  6. Description = show the time you browse an HTML file
  7. ========== Description Part End ==========
  8.  
  9. ========== Parameter Part Begin ==========
  10. StayTimePara = 6,Center,Text
  11. JsBoxType = 2
  12. ========== Parameter Part End ==========
  13.  
  14. ========== Resource Part Begin ==========
  15. Resource Number = 0
  16. ========== Resource Part End ==========
  17.  
  18. ========== HTML Part Begin ==========
  19. Segment Number = 1
  20. Segment Position = cursor
  21. <form name="srctecstaytime" onSubmit="0">
  22. <div align="Center">
  23. <input type="Text" name="time_spent" size="6" onFocus="this.blur()">
  24. </div>
  25. </form>
  26. <script LANGUAGE="JAVASCRIPT">
  27. var time_start = new Date();
  28. var clock_start = time_start.getTime();
  29. function get_time_spent ()
  30. {
  31.     var time_now = new Date();
  32.     return((time_now.getTime() - clock_start)/1000); 
  33. }
  34. function show_secs ()
  35. {
  36.     var i_total_secs = Math.round(get_time_spent()); 
  37.     var i_secs_spent = i_total_secs % 60;
  38.     var i_mins_spent = Math.round((i_total_secs-30)/60); 
  39.     var s_secs_spent = "" + ((i_secs_spent>9) ? i_secs_spent : "0" + i_secs_spent);
  40.     var s_mins_spent = "" + ((i_mins_spent>9) ? i_mins_spent : "0" + i_mins_spent);
  41.     document.srctecstaytime.time_spent.value = s_mins_spent + ":" + s_secs_spent;
  42.     window.setTimeout('show_secs()',1000); 
  43. }
  44. window.setTimeout('show_secs()',1);
  45. </script>
  46. ===== Segment End =====
  47. ========== HTML Part End ==========
  48.  
  49.